package com.yiji.fintech.musfinance.common.strategy.converter;

import com.yiji.fintech.musfinance.common.domain.base.BaseDomain;
import com.yiji.fintech.musfinance.common.domain.base.DepositDomain;
import com.yiji.fintech.musfinance.common.domain.channel.ChannelDomain;
import com.yiji.fintech.musfinance.common.strategy.base.AbstractContext2DomainStrategy;
import com.yiji.fintech.musfinance.common.strategy.context.TransactionContext;
import org.springframework.stereotype.Service;

/**
 * 路由渠道上线文转换充值Domain
 * Created by ouwen@yiji.com} on 2017/9/22.
 */
@Service
public class Context2DepositDomainStrategy extends AbstractContext2DomainStrategy {
    @Override
    public void doExcute(ChannelDomain channelDomain, BaseDomain domain) {
        DepositDomain depositDomain = (DepositDomain) domain;
        TransactionContext context = channelDomain.getContext();
        depositDomain.setGatewayChannelApi(channelDomain.getInstChannelApis().get(0).getGatewayChannelApi());
        depositDomain.setRecBankId(context.getBfjBankId());//context.getSettleInstId()
        depositDomain.setRecBankName(context.getBfjBankName());
        depositDomain.setRecAccountName(context.getBfjBankAccountName());
        depositDomain.setRecAccountNo(context.getBfjBankAccountNo());
        depositDomain.setRecBankName(context.getBfjBankName());
        depositDomain.setRecUnionBankNo(context.getUnionBankNo());
        depositDomain.setPartnerId(channelDomain.getPartnerId());
    }
}
